﻿using System;
using System.Collections.ObjectModel;
using MaxStoreErp.Core.BaseClasses;
using MaxStoreErp.Core.Commands;
using MaxStoreErp.Core.Interfaces;
using MaxStoreShop.Domain.Directories;

namespace MaxStoreShop.CoreModule.Login
{
    public class LoginViewModel : ViewModelBase
    {
        public RelayCommand EnterCommand { get; set; }
        public Action OnEnterPassword { get; set; }
        IUser _selectedUser;
        string _password;
        ObservableCollection<StoreUser> _users;
        bool _isErrorOccured;
        string _errorText;

        public IUser SelectedUser
        {
            get { return _selectedUser; }
            set { OnPropertyChanged(ref _selectedUser, value, "SelectedUser"); }
        }

        public string Password
        {
            get { return _password; }
            set { OnPropertyChanged(ref _password, value, OnEnterPassword, "Password"); }
        }

        public ObservableCollection<StoreUser> Users
        {
            get { return _users; }
            set { OnPropertyChanged(ref _users, value, "Users"); }
        }

        public bool IsErrorOccured
        {
            get { return _isErrorOccured; }
            set { OnPropertyChanged(ref _isErrorOccured, value, "IsErrorOccured"); }
        }

        public string ErrorText
        {
            get { return _errorText; }
            set { OnPropertyChanged(ref _errorText, value, "ErrorText"); }
        }
    }
}
